package com.crud.controller;


import com.crud.aspect.DataSource;
import com.crud.pojo.User;
import com.crud.service.IUserService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;


@Controller
@ResponseBody
public class UserController {
    @Resource
    private IUserService service;

    @RequestMapping("/user")
    @DataSource(DataSource.slave)
    public List<User> getAllUsers() {
        return service.getAllUsers();
    }
}
